package org.theqcp.wow.sim.engine.old;

import java.util.HashMap;
import java.util.HashSet;

import org.theqcp.wow.model.items.WeaponType;
import org.theqcp.wow.model.mechanics.Slot;
import org.theqcp.wow.model.player.Player;
import org.theqcp.wow.sim.engine.revised.EquipmentPointConfig;
import org.theqcp.wow.sim.engine.revised.PlayerStats;
import org.theqcp.wow.sim.engine.revised.scripts.AutoAttackObserver;
import org.theqcp.wow.sim.engine.revised.scripts.SimulationEventObserver;

@SuppressWarnings( "unused" )
public class EnhSimConfig {

    private final HashSet<SimulationEventObserver> observerSet = new HashSet<SimulationEventObserver>();
    private final HashMap<Slot, WeaponType> weaponMap = new HashMap<Slot, WeaponType>(2);
    private final PlayerStats playerStats;

    private EquipmentPointConfig equipmentPointConfig;
    private boolean simulateMana;
    private int maxThreads;
    private int lagMin;
    private int lagMax;

    public EnhSimConfig(Player player) {
	this(new PlayerStats(player));
    }

    public EnhSimConfig(PlayerStats playerStats) {
	this.playerStats = playerStats;
    }

    public EquipmentPointConfig getEquipmentPointConfig() {
	return equipmentPointConfig;
    }

    public void setEquipmentPointConfig( EquipmentPointConfig equipmentPointConfig ) {
	this.equipmentPointConfig = equipmentPointConfig;
    }

    public Player getPlayer() {
	return this.playerStats.getPlayer();
    }

    public void setThreads( int count ) {
	this.maxThreads = count;
    }

    public void setLag( int min, int max ) {
	if( min < 0 )
	    min = 0;
	if( max <= min )
	    max = min;

	this.lagMin = min;
	this.lagMax = max;
    }

    public void setSimulateMana( boolean simulateMana ) {
	this.simulateMana = simulateMana;
    }

    public boolean addObserver( SimulationEventObserver observer ) {
	return observerSet.add(observer);
    }

    public void setWeaponType( Slot slot, WeaponType weaponType ) {
	weaponMap.put(slot, weaponType);
    }

}
